var bookModel=require('../models/books');
var authorInfoModel=require('../models/authorInfo');
const bookDetil = {
    bookDetil: (req, res, next) => {
    bookModel.findOne({ _id: req.query.id}).populate('author_id').populate('colmun_id').then(doc=>{
        authorInfoModel.findOne({ author_id: doc.author_id }).populate('author_id').then(doc2=>{
            res.render('bookDetil', { book: doc, loginUser: req.session.userLogin,authorInfo:doc2 })
        })
       }).catch(err=>{
            console.log(err)
        })
    }
}
module.exports = bookDetil;